#pragma once
#include <memory>
#include <map>
#include <mutex>
#include "AEncoder.h"
namespace Media{

    class AEncoderManager{
    public:
        #define MAX_ENCODER_NUM 16
        using EncChannel = int;
        using EncEnabled = bool;
        using Ptr = std::shared_ptr<AEncoderManager>;
        static Ptr Instance();
        AEncoderManager();
        ~AEncoderManager();
        bool CreateEncoder(AEncoder::Ptr& ptr, const AEncoderConfig& config);
        bool ReleaseEncoder(const AEncoder::Ptr& ptr);
    
    private:
        bool getAvailableChannel(EncChannel& channel);
        std::map<EncChannel, EncEnabled> m_encoders;
        std::recursive_mutex m_mux;

    };
}